Using multiple threads with IVtk

您所在的位置:网站首页 tessellation cache Using multiple threads with IVtk

Using multiple threads with IVtk

2023-07-22 01:13| 来源: 网络整理| 查看: 265

After many tests I have come to conclusion that IVtk_IShapeMesher::Build() must be corrupting data structure when run with multiple threads. I have run tests with OMP (#pragma omp parallel for) and std::thread.

What we have is a loop in which threads are created and function is being run.

The meta - code of function is like this:

function() { IVtkOCC_Shape::Handle aShapeImpl = new IVtkOCC_Shape(shape); if (!aShapeImpl.IsNull()) { IVtkVTK_ShapeData::Handle aDataImpl = new IVtkVTK_ShapeData(); IVtk_IShapeMesher::Handle aMesher = new IVtkOCC_ShapeMesher();

//this is where we crash when run with multiple threads - `Access Violation`; //if we run it with '#pragma omp critical' for OMP, which will execute block of code in a single thread at a time - no exceptions are thrown. aMesher->Build(aShapeImpl, aDataImpl);

//... some more code

}

}

Any comments or ideas on how to get this running in multiple threads are welcome. Change the approach maybe ?



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3